package model;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionManager {
	
	// Connection details for the MySQL database
	public static String URL;
	public static String GROUP;
	public static String PASSWORD;
	
	public ConnectionManager() {
		URL = "jdbc:mysql://academic-mysql.cc.gatech.edu/";
		GROUP = "cs4400_Group_64";
		PASSWORD = "L4fslZ52";
	}
	
	/**
	 * Creates and returns a new connection to the database
	 * @return A new connection to the database
	 */
	public Connection getNewConnection() {
		Connection conOut = null;
		
		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			
			conOut = DriverManager
					.getConnection(URL + GROUP, GROUP, PASSWORD);
			
			if (!conOut.isClosed()) {
				//System.out.println("Successfully connected to "
				//		+ "MySQL server using TCP/IP...");
			}
		} catch (Exception e) {
			System.err.println("Exception: " + e.getMessage());
		} finally {
			
		} // close finally
		return conOut;
	}
	
}
